/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import java.io.IOException;
import java.net.InetSocketAddress;
import net.spy.memcached.MemcachedClient;
/**
 *
 * @author minh3d
 */
public class Memcached {
    public static MemcachedClient mem = null;
    public static int portNum = 11211;
    public static String host = "127.0.0.1";

    public static void run() throws IOException {
        mem = new MemcachedClient(new InetSocketAddress(host, portNum));
        //mem.shutdown();
    }

    public static void set(String key, int expire, Object obj) {
        mem.set(key, expire, obj);
    }

    public static Object get(String key) {
        return mem.get(key);
    }

    public static void stop() throws IOException {
        mem.shutdown();
    }
}
